package com.crux.demo;

import com.crux.feign.DemoClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class DemoServiceImpl implements DemoService{
    @Autowired
    private DemoClient demoClient;
    @Autowired
    private RestTemplate restTemplate;

    @Override
    public String product() {
        return demoClient.ping();
    }

    @Override
    public String productV2(String version) {
        String url = "http://product/product/api/demo/ping?version="+version;
        return restTemplate.getForObject(url, String.class);
    }

    @Override
    public String productHeader(String keyName) {
        String url = "http://product/product/api/demo/header";
        return restTemplate.getForObject(url,String.class);
    }
}
